package org.diysearch.interfaces;

import java.io.OutputStream;
import java.io.Writer;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.diysearch.exceptions.ObjectNotSupportedException;

public interface Product {
    /**
     * Set the data for the output
     * @param output
     */
public void setOutput (Object output) throws ObjectNotSupportedException;
/**
 * The final output will be generated depending upon which is set OutputStream or Writer.
 * printing or echoing is done after this method is called
 */
public void print ();

/**
 * Set the content type (ct)
 * @param ct
 */
public void setContentType(String ct);

/**
 * Typically returns "text/html" but it depends on the product
 * @return
 */
public String getContentType();
/**
 * The Servlet's output stream which is actually the reference from response.getOutputStream
 * @param outputStream
 */
public void setOutputStream(OutputStream outputStream);
/**
 * The Servlet's writer which is actually the reference from response.getWriter or JspWriter
 * @param writer
 */
public void setWriter(Writer writer);

    /**
     * 
     * @param completed Completed is a string that tells the product what exactly it should do
     * A completed string will look like the following:<br/>
     * template:some_template.vm<br/>
     * redirect:/some/url<br/>
     * dispatch:/some/url<br/>
     * binary: (no argument required)<br/>
     * @param request HttpServletRequest
     * @param response HttpServletResponse
     * @param templateEngine pass a template engine i.e. VelocityTemplate
     * @param content the data to be generated
     * @throws Exception
     */
public void setCompleted(String completed, 
		HttpServletRequest request, 
		HttpServletResponse response, 
		TemplateEngine templateEngine, 
		Map<String,Object> content) throws Exception;
}
